


 function vusername(o) {
   
   var user = /[(\*\(\)\[\]\+\.\,\/\?\:\;\'\"\`\~\\#\$\%\^\&\<\>)+]/;
    if (!o.value.match(user)) {
      if (o.value != ""){      
	      doValidate(o);
	      
      }      
       else{
       	doError(o,"please give a username");
       }
      
      
     } else {
      doError(o,ValMsg.USERNAME_ERROR);
     }
 }
 
 function vemail(o) {
   var email  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (o.value.match(email)) {
       //doSuccess(o);
       if (o.value != ""){
       	doValidate(o);
       }
       else{
       	doError(o,"please give a email");
       }
     } else {
       doError(o,ValMsg.EMAIL_ERROR);
     }
 }
     
function vpassword(o){
	var password =  $('#password');
	var password2 = $('#password2');
	//if (o.name = "password" )
	if (password.val() != "" && password2.val() == ""){		
		//alert("ok");
		return true;
	}
	if(password.val() != password2.val()){
		$('#password').val("");
		
		$('#password2').val("");
		$('#password').get(0).focus();
		//doError(password,'password not match');
	}
}

   function doSuccess(o) {
            $('#' + o.id + '_img').html('<img src="/images/accept.gif" border="0" style="float:left;" />');
            //$('#' + o.id + '_td').removeClass("error");
            $('#' + o.id + '_msg').html("");
            //$('#' + o.id + '_td').addClass("success");
   }

   function doError(o,m) {
   		  
            $('#' + o.id + '_img').html('<img src="/images/exclamation.gif" border="0" style="float:left;" />');
            //$('#' + o.id + '_td').addClass("error");

            $('#' + o.id + '_msg').html(m);
            //$('#' + o.id + '_td').removeClass("success");              
            $('#' + o.id).val("");
            $('#' + o.id).get(0).focus();
   }
   //private helper, validates each type after check
   function doValidate(o) {
      	$('#' + o.id + '_img').html('<img src="/images/loading.gif" border="0" style="float:left;" />');
      	$.post('/module/ajax/ajax.do', { id: o.id, value: o.value }, function(json) {
                	eval("var args = " + json);
                  if (args.success == true)
                	{
                	  doSuccess(args);
                	}
                	else
                	{
                    doError(args,args.msg);
                	}
                });
  }

